package com.bhudy.exception;

/**
 * @Author com.bhudy
 * @Description 异常状态
 * @Date 2019-10-30 23:09:37
 */
public enum SysExceptionCode {

    CODE_0(0),
    CODE_10001(10001), CODE_10002(10002), CODE_10003(10003),

    CODE_20001(20001), CODE_20002(20002), CODE_20003(20003), CODE_20004(20004), CODE_20005(20005), CODE_20006(20006), CODE_20007(20007), CODE_20008(20008), CODE_20009(20009), CODE_20010(20010),
    CODE_20011(20011), CODE_20012(20012), CODE_20013(20013), CODE_20014(20014), CODE_20015(20015), CODE_20016(20016), CODE_20017(20017),

    CODE_40001(40001), CODE_40002(40002), CODE_40003(40003), CODE_40004(40004), CODE_40005(40005), CODE_40006(40006), CODE_40007(40007), CODE_40008(40008), CODE_40009(40009), CODE_40010(40010),
    CODE_40011(40011), CODE_40012(40012), CODE_40013(40013), CODE_40014(40014), CODE_40015(40015), CODE_40016(40016), CODE_40017(40017), CODE_40018(40018), CODE_40019(40019), CODE_40020(40020),
    CODE_40021(40021), CODE_40022(40022), CODE_40027(40027), CODE_40028(40028), CODE_40029(40029), CODE_40030(40030), CODE_40031(40031), CODE_40032(40032), CODE_40033(40033), CODE_40034(40034),
    CODE_40035(40035), CODE_40036(40036), CODE_40037(40037), CODE_40038(40038), CODE_40039(40039), CODE_40040(40040), CODE_40041(40041), CODE_40042(40042), CODE_40043(40043), CODE_40044(40044),
    CODE_40045(40045), CODE_40046(40046);

    private Integer code;

    SysExceptionCode(Integer code) {
        this.code = code;
    }

    public Integer getCode() {
        return this.code;
    }

    public static String getMessage(int code) {
        switch (code) {
            case 0:
                return "处理成功";
            case 10001:
                return "登陆成功";
            case 10002:
                return "退出登录";
            case 10003:
                return "绑定账号成功";

            case 20001:
                return "RuntimeException 运行时异常";
            case 20002:
                return "NullPointerException 空指针异常";
            case 20003:
                return "ClassCastException 类型转换异常";
            case 20004:
                return "IOException IO异常";
            case 20005:
                return "NoSuchMethodException 未知方法异常";
            case 20006:
                return "IndexOutOfBoundsException 数组越界异常";
            case 20007:
                return "HttpMessageNotReadableException 400错误";
            case 20008:
                return "TypeMismatchException 400错误";
            case 20009:
                return "MissingServletRequestParameterException 400错误";
            case 20010:
                return "HttpRequestMethod and NotSupportedException 405错误";
            case 20011:
                return "HttpMediaTypeNotAcceptableException 406错误";
            case 20012:
                return "ConversionNotSupportedException 500错误";
            case 20013:
                return "StackOverflowError 栈溢出";
            case 20014:
                return "ArithmeticException 算术条件异常";
            case 20015:
                return "NumberFormatException 数字格式化异常";
            case 20016:
                return "ParseException 解析异常";
            case 20017:
                return "EOFException 文件已结束异常";


            case 40001:
                return "处理失败";
            case 40002:
                return "当前操作对象不存在";
            case 40003:
                return "参数不匹配";
            case 40004:
                return "类型转换失败";
            case 40005:
                return "";
            case 40006:
                return "用户不存在或者密码错误";
            case 40007:
                return "操作失败，有关联数据";
            case 40008:
                return "用户名或者密码不能为空";
            case 40009:
                return "用户名或者密码不正确";
            case 40010:
                return "用户状态异常，请联系管理员";
            case 40011:
                return "登陆出现未知错误";
            case 40012:
                return "登陆身份验证失败";
            case 40013:
                return "该用户没有权限";
            case 40014:
                return "找不到页面";
            case 40015:
                return "没有找到主键";
            case 40016:
                return "查询到多个结果集";
            case 40017:
                return "登陆令牌已过期，请重新登陆";
            case 40018:
                return "与串口设备通讯中断";
            case 40019:
                return "串口设备写入失败";
            case 40020:
                return "串口设备读取失败";
            case 40021:
                return "打开通讯串口失败";
            case 40022:
                return "串口读取数据超时";
            case 40027:
                return "IO流出错";
            case 40028:
                return "key is not null";
            case 40029:
                return "获取微信Token失败";
            case 40030:
                return "密码长度不能小于8位";
            case 40031:
                return "当前状态不能重置或者修改密码";
            case 40032:
                return "错误的工单状态码";
            case 40033:
                return "当前状态不可操作";
            case 40034:
                return "找不到关联数据";
            case 40035:
                return "人员产品库存数量不足或者数据出错";
            case 40036:
                return "下阶段处理人不能为空";
            case 40037:
                return "数据格式不正确";
            case 40038:
                return "获取二维码失败";
            case 40039:
                return "access_token错误或者过期";
            case 40040:
                return "公共数据配置错误";
            case 40041:
                return "未绑定账号";
            case 40042:
                return "该账号已被其他用户绑定";
            case 40043:
                return "没有找到登录令牌";
            case 40044:
                return "数据已存在";
            case 40045:
                return "不支持该文件格式";
            case 40046:
                return "密码长度不能大于16位";
            default:
                return null;
        }
    }

    public String getMessage() {
        return getMessage(this.code);
    }
}
